:root {
    --ai-icon-color: #333333;
    --ai-font-color: #000000;
    --ai-bg-color: #ffffff;
    --ai-bg2-color: #f1f1f1;
    --ai-btn-color: #cccccc;
    --ai-brd-color: #eeeeee;
    --ai-cbg-color: #f4f4f4;
    --ai-list-selected-color: #eeeeee;
    --ai-bg3-color: #fcfcfc;
    --ai-brd2-color: #333333;
    --ai-bg-select-color: #f7f7f7;
    --ai-filter-icon: none;
    --ai-input-brd-color: #d4d4d4;
    --ai-select-brd-color: #cccccc;
    --ai-prl-bg-color: #e5e5e5;
    --ai-draw-bg-color: #f5f5f5;
    --ai-cbtn-color: #f4f4f4;
    --ai-cbtn-brd:#d6d6d6;
    --ai-cbtn-ref:#f7f7f7;
    --ai-plpr-bg: #f2f9ff;
    --ai-plpr-br:#bde3ff;
    --ai-guide-link: #ffffff; 
    --ai-bg-select-color:#eeeeee; 
    --ai-placeholder-color: #8e8e8e; 
}
  
::webkit-scrollbar-track {
    background: var(--ai-bg-color); /* Цвет трека (фона) скроллбара */
}
  
::webkit-scrollbar-thumb {
    background: #555; /* Цвет ползунка скроллбара */
}
  
::webkit-scrollbar-thumb:hover {
    background: #777; /* Цвет ползунка при наведении */
}
  
[data-theme="dark"] {
    --ai-icon-color: #ffffff;
    --ai-font-color: #ffffff;
    --ai-bg-color: #696969;
    --ai-bg2-color: #717171;
    --ai-btn-color: #828282;
    --ai-brd-color:#606060;
    --ai-cbg-color:#5f5f5f;
    --ai-list-selected-color:#828282;
    --ai-bg3-color: #717171;
    --ai-brd2-color:#ababab;
    --ai-bg-select-color:#717171;
    --ai-filter-icon:brightness(0) invert(1);
    --ai-input-brd-color:#606060;
    --ai-select-brd-color:#606060;
    --ai-prl-bg-color:#696969;
    --ai-draw-bg-color:#d5d5d5;
    --ai-cbtn-color:#5e5e5e;
    --ai-cbtn-brd:#656565;
    --ai-cbtn-ref:#656565;
    --ai-plpr-bg: #555555;
    --ai-plpr-br:#555555;
    --ai-guide-link: #b3b3b3; 
    --ai-scroll-thumb: #4f4f4f; 
    --ai-scroll-hover: #434343; 
    --ai-bg-select-color:#717171; 
    --ai-placeholder-color: #717171; 
}
html, body {
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
    font-size: 14px;
    color: #000;
    height: 100%;
    width: 100%;
}
.ai{
    display: flex;
    height: 100%;
    width: 100%;
    flex-direction: column;
    z-index: 9999;
    background: var(--ai-bg-color);
    transition: opacity 1s ease-in-out;
}
.ai_hide {
  opacity: 0;
}
.ai_content{
    display: flex;
    height: calc(100% - 50px);
    width: 100%;
    align-items: center;
    justify-content: center;
}

.ai_case{
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 700px;
    width: 100%;
    margin: 15px;
    margin-top: -100px;
    position: relative;
}
.ai_btn{
    max-width: 200px;
    width: 100%;
    height: 40px;
    border-radius: 6px;
    border: 0;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    background: #f4f4f4;
    align-items: center;
    text-decoration: none;
    color: #333333;
}
.ai_material_btn{
    padding: 10px;
    height: 50px;
    border-radius: 6px;
    border: 0;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    background: #f4f4f4;
    align-items: center;
    text-decoration: none;
    color: #333333;
}
.ai_case_btns{
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-evenly;
}
.ai_case_text{
    width: 100%;
    position: relative;
    flex-direction: column;
    display: flex;
    background: var(--ai-cbg-color);
    border-radius: 6px;
    margin-bottom: 25px;
    border: 1px solid var(--ai-input-brd-color);
    transition: border-color 0.3s ease;
}
.ai_textarea{
    width: 100%;
    height: 100%;
    background: transparent;
    border: 0;
    border-radius: 6px;
    font-size: 16px;
    padding: 7px 10px;
    box-sizing: border-box;
    outline: none;
    font-family: 'Arial', sans-serif;
    /*resize: vertical;*/
    resize: none;
    min-height: 80px;
    caret-color: var(--ai-btn-color)!important;
}

.ai_case_text:has(textarea:focus) {
  border-color: var(--ai-prl-bg-color);
}
.ai_textarea::placeholder {
  color: var(--ai-placeholder-color);
}

.ai_send{
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    background: var(--ai-btn-color);
    padding: 0;
    cursor: pointer;
    margin: 5px;
    transition: opacity 0.3s ease;
    position: relative;
}

.ai_send.ai_loading svg {
    opacity: 0;
}

.ai_send.ai_loading:after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -12px;
    margin-top: -12px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spinner 0.8s linear infinite;
}

@keyframes spinner {
    to {transform: rotate(360deg);}
}


.ai_left{
    width: 100%;
}
.ai_right{
    width: 50px;
}
.ai_pen:before{
    content: '';
    display: block;
    width: 16px;
    height: 16px;
    background: url(../img/pencil.svg) no-repeat center;
    background-size: contain;
    margin-right: 5px;
}
.ai_image:before{
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    background: url(../img/image.svg) no-repeat center;
    background-size: contain;
    margin-right: 5px;
}

.ai_photo:before{
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    background: url(../img/photo.svg) no-repeat center;
    background-size: contain;
    margin-right: 5px;
}
.ai_btn:hover {
    background-color: #eaeaea;
    transition: background-color 0.3s ease;
}
.ai_material_btn:hover {
    background-color: #eaeaea;
    transition: background-color 0.3s ease;
}

.ai_bouncing-icon {
    height: 40px;
    
    top: -60px;
    width: 40px;
    position: absolute;
    left: 50%;
    margin-left: -20px;
}
.ai_bouncing-animate {
    animation: bounce 1s infinite;
}
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(7px);
    }
}

.ai_icon{
    display: inline-block;
    width: 20px;
    height: 20px;
    stroke-width: 0;
    stroke: #000000;
    fill: #000000;
    vertical-align: middle;
}
.ai_logo_link{
    display: block;
}

.ai_textarea_actions {
    width: 100%;
    display: flex;
    justify-content: space-between; /* Кнопки по краям */
    align-items: center;
}







/* Стили для окна выбора материалов */
.ai_materials_window {
    display: none; /* Скрыто по умолчанию */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--ai-bg-color);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 999999; /* Выше, чем ai_overlay */
    min-width: 350px;
    box-sizing: border-box;
}

.ai_materials_window.visible {
    display: block; /* Показываем окно */
}

.ai_material-selector {
    display: flex;
    flex-direction: column;
    gap: 20px; /* Пространство между группами селекторов */
}

.ai_selector-group {
    display: flex;
    flex-direction: column;
    gap: 8px; /* Пространство между label и select */
}

.ai_selector-group label {
    font-weight: bold;
    font-size: 14px;
}

.ai_selector-group select {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
    cursor: pointer;
    outline: 0;
    color: #333333;
}
.ai_selector-group select option{
    color: #333333;
}
.ai_select-material-btn {
    padding: 12px 20px;
    background-color: #0D99FF;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 10px; /* Небольшой отступ сверху */
    align-self: center; /* Центрируем кнопку */
}

.ai_select-material-btn:hover {
    background-color: #0a7acc;
}

/* Стили для кастомного селекта изображений */
.ai_custom-select-container {
    position: relative;
}

.ai_custom-select-trigger {
    width: 100%;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    font-size: 14px;
    box-sizing: border-box;
    outline: none;
    color: #333333;
}

.ai_selected-option-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai_selected-option-img {
    width: 28px; /* Размер иконки в кнопке */
    height: 28px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
}

.ai_arrow {
    font-size: 12px;
    color: #555;
}

.ai_custom-select-options {
    display: none; /* Скрыты по умолчанию */
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
    max-height: 200px;
    overflow-y: auto;
}

.ai_custom-select-options.visible {
    display: block;
}

.ai_custom-select-option {
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: #333333;
}

.ai_custom-select-option:hover {
    background-color: #f0f0f0;
}
.ai_selected-option-text{
    color: #333333;
}
.ai_custom-select-option img {
    width: 40px; /* Размер картинки в опциях */
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.ai_custom-select-option span {
    font-size: 14px;
    color: #333333;
}

/* Стилизация скроллбара для опций */
.ai_custom-select-options::-webkit-scrollbar {
    width: 6px;
}

.ai_custom-select-options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.ai_custom-select-options::-webkit-scrollbar-thumb {
    background: #aaa;
    border-radius: 3px;
}

.ai_custom-select-options::-webkit-scrollbar-thumb:hover {
    background: #888;
}


/* Стили для кастомных инпутов размера листа */
.ai_custom-input-group {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #eee;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai_custom-input-group.hidden {
    display: none;
}

.ai_custom-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai_custom-input-row label {
    font-weight: normal; /* Отменяем bold из .selector-group label */
    font-size: 14px;
    color: var(--ai-font-color);
    width: 60px; /* Фиксированная ширина для выравнивания */
    flex-shrink: 0;
}

.ai_custom-input-row input[type="number"] {
    flex-grow: 1;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    color: #333333;
}


/* Убираем стрелки у number инпутов (опционально) */
.ai_custom-input-row input[type=number]::-webkit-inner-spin-button,
.ai_custom-input-row input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.ai_custom-input-row input[type=number] {
  -moz-appearance: textfield;
}


.ai_custom-select-options::-webkit-scrollbar-thumb:hover {
    background: #888;
}

.ai_settings_button{
  height: 50px;
  cursor: pointer;
  border: 0;
  background: transparent;
  border-radius: 6px;
  display: flex;
  padding: 0 10px;
  font-size: 14px;
  align-items: center;
}

.ai_settings_button:hover{
  background: var(--ai-bg-select-color);
}
.ai_settings_button img{
  height: 24px;
  width: 24px;
  margin-right: 5px;
  border-radius: 3px
}

.ai_overlay_stop{
  width: 100%;
  height: 100%;
  position: fixed;
  top:0;
  left:0;
  z-index: 99999;
  display: none;
  background: #333333;
  opacity: 0.7;
}

.ai_title{
    font-size: 24px;
    margin-bottom: 25px;
    font-weight: bold;
    margin-top: 0;
    text-align: center;
}

/* Адаптация основных элементов для работы с меню */
.ai_header {
    background: var(--ai-bg-color);
    font-size: 0;
    width: 100%;
    height: 50px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 9999; /* Повышаем z-index для header */
  }
  .ai_header_title{
    font-size: 26px;
    padding-left: 15px;
    font-weight: bold;
  }
.ai_header_right{
    display: flex;
    align-items: center;
}
  .ai_logo{
    display: flex;
    align-items: center;
    position: relative;
    font-size: 0;
  }
  .ai_logo_link{
    display: flex;
    fill: var(--font-color);
    color: #333333;
    font-size: 22px;
    text-decoration: none;
  }
  .ai_exit{
    width: 50px;
    height: 50px;
    text-align: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }
  .ai_exit:hover{
    background: var(--bg-select-color);
  }
  .auth_menu{
    margin-right: 15px;
  }
 
.ai_header_link{
    font-size: 16px;
    margin-left: 15px;
    cursor: pointer;
    color: #333333;
    text-decoration: none;
}

.ai_user_icon{
    position: relative;
    display: flex;
    background: #f4f4f4;
    border: 0;
    height: 40px;
    width: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}
.ai_user_icon:hover {
    background-color: #eaeaea;
    transition: background-color 0.3s ease;
}
.ai_user_icon:before {
	display: inline-flex;
    content: '';
    background-image: url(../img/person_black.svg);
    background-size: cover;
    height: 22px;
    width: 22px;
    position: absolute;
    background-repeat: no-repeat;
}
.ai_coins_link{
    font-size: 16px;
    line-height: 1.2;
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;
    text-decoration: none;
    color: #333333;
}
.ai_coins_link:hover {
    background-color: var(--ai-bg-select-color);
    transition: background-color 0.3s ease;
}
.ai_login_link{
    border: 0;
    height: 40px;
    background: #f4f4f4;
    display: flex;
    align-items: center;
    padding: 0 15px;
    border-radius: 6px;
}
.ai_login_link:hover {
    background-color: #eaeaea;
    transition: background-color 0.3s ease;
}











.ai_error_message{
    transform: translateX(-50%);
    max-width: 400px;
    z-index: 99999;
    top: 60px;
    left: 50%;
    position: fixed;
    background: #ffe2cc;
    min-width: 200px;
    padding: 10px;
    border-radius: 6px;
    display:none;
}

@media screen and (max-width: 768px) {

    .ai_case_btns{
        flex-direction: column;
    }
    .ai_btn{
        margin-bottom: 10px;
        margin-right: 0;
    }
    .ai_case{
        margin-top: 0;
    }
}
